<template>
  <a-card :bordered="false">
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        @change="handleTableChange">
        <span slot="actionName">
          <a-button size="small" @click="handleAdd('方案-新增')" type="primary" icon="plus">新增</a-button>
        </span>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record,'方案-编辑')">编辑</a>
           <a-divider type="vertical"/>
          <a @click="handleEditTree(record,'方案树-编辑')">方案树编辑</a>
           <a-divider type="vertical"/>
          <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
            <a>删除</a>
          </a-popconfirm>
        </span>
      </a-table>
    </div>
    <!-- table区域-end -->
    <CheckAndEditModel ref="modalForm" @ok="modalFormOk"></CheckAndEditModel>
    <faTree ref="faTree"></faTree>
  </a-card>
</template>

<script>
  import {JeecgListMixin} from '@/mixins/JeecgListMixin'
  import CheckAndEditModel from './CheckAndEditModel'
  import faTree from './faTree'
  import columns from './indexColumns'

  export default {
    name: 'sjrygl',
    mixins: [JeecgListMixin],
    components: {
      CheckAndEditModel,
      faTree
    },
    data() {
      return {
        queryParam: {},
        // 表头
        columns: columns(this),
        url: {
          list: '/sjxmzygl/sjWorkZtfa/getProTemplatList',
          delete: '/sjxmzygl/sjWorkZtfa/delProTemplat'
        },
      }
    },
    computed: {},
    created() {
    },
    methods: {
      handleEditTree(record, name) {
        this.$refs.faTree.edit(record);
        this.$refs.faTree.title = name;
      },
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less'
</style>